/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package domain.controller.file;

import java.util.Hashtable;
import javax.microedition.lcdui.Image;

/**
 *
 * @author victorino
 */
public class ImageController {

    private static ImageController instance  = new ImageController();

    private Hashtable imagens = new Hashtable();

    public static ImageController getInstance() {
        return instance;
    }

    private ImageController() {

    }
    
    public Image getImage(String imagemNome){

        Image img = (Image)imagens.get(imagemNome);

        if(img == null){
            try {
                img = Image.createImage("/data/" + imagemNome + ".png");
                imagens.put(imagemNome, img);
            } catch (java.io.IOException e) {
                e.printStackTrace();
            }
        }
        return img;
    }

    public Image getBuscaImagem(){
        return getImage("busca_portal");
    }

    public Image getCategoriaImagem(){
        return getImage("categoria_portal");
    }

    public Image getRegistroImagem(){
        return getImage("registro_portal");
    }

    public Image getLogoImagem(){
        return getImage("logo_portal");
    }

    public Image getVoltarImagem(){
        return getImage("voltar_portal");
    }
}
